﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace QLKN.GUI
{
    public partial class frmKetnoi : Form
    {
        public frmKetnoi()
        {
            InitializeComponent();
        }
        static String serverName = "";
        static String databaseName = "";
        static String user = "";
        static String pass = "";
        static SqlConnection conn;
        static String strconn = "";
        private void btKetnoi_Click(object sender, EventArgs e)
        {
                serverName = txtMaychu.Text;
                databaseName = txtCsdl.Text;
                user = txtTaikhoan.Text;
                pass = txtpass.Text;
            
            strconn = @"Data Source="+ serverName +"; Initial Catalog="+ databaseName +"; Uid="+ user +"; pwd="+ pass +"";
            try
            {
                conn = new SqlConnection(strconn);
                this.Hide();
                frmDangnhap frm = new frmDangnhap();
                frm.ShowDialog();
                this.Dispose();
                //MessageBox.Show(""+pass);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Thông tin nhập vào không đúng, đề nghị nhập lại!","Thông Báo");
            }
            
        }
        public static String Layketnoi1()
        {
            return strconn;
        }

        private void btHuy_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }
    }
}
